package net.bolue.console.action;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import net.bolue.sysmng.console.MetaDataAdmin;
import net.bolue.sysmng.db.metadata.TblMetaData;
import net.bolue.sysmng.exception.BolueException;
import net.bolue.web.mvc.AbstractAction;
import net.bolue.web.mvc.ActionResult;
import net.bolue.web.report.RepConstants;
import net.bolue.web.util.RequestUtil;

/**
 * 获得数据表
 * @author Administrator
 *
 */
public class SelTabls extends AbstractAction{

	@Override
	public ActionResult perform(HttpServletRequest request,
			HttpServletResponse response) throws BolueException {
		String subSys = RequestUtil.getParamValue(request, RepConstants.REP_SUBSYS_KEY);
		if(subSys==null || subSys.trim().length()==0){
			throw new BolueException(1,"必须提供subSys参数值!");
		}
		MetaDataAdmin metaDataAdmin = new MetaDataAdmin();
		List<TblMetaData> tblList = metaDataAdmin.getTblList(subSys, null, null);
		ActionResult actionResult = new ActionResult();
		Map<String,Object> pageMap = new HashMap<String,Object>();
		pageMap.put("rows", tblList);
		actionResult.setData(pageMap);
		actionResult.setResult(true);
		return actionResult;
	}
}
